<template>
  <div class="container">
    <div class="xq">
      <section class="zxsc2 af">
        <div class="left">
          <p class="wz">当前位置：<router-link to="/">首页</router-link> > <router-link to="/Info">行业资讯</router-link> > {{title.xq.currentInfo.keyword}}</p>
          <div class="xqtop">
            <h3>{{title.xq.currentInfo.title}}</h3>
            <div class="ctdb">
              <span class="house">来源：{{title.xq.currentInfo.keyword}}</span>
              <em>阅读量：{{title.xq.currentInfo.readnum}}</em>
              <i>时间：{{title.xq.currentInfo.createtime}}</i>
              <div  v-html="msg2" class="dbct">
              </div>
            </div>
            <div class="xqbt af">
              <div class="left">
                <a href="javascript:;" class="syp" @click="qh(title.xq.upInfo.id,title.xq.upInfo.title)">上一篇:{{title.xq.upInfo.title==undefined?'没有了~~':title.xq.upInfo.title}}</a><br/>
                <a href="javascript:;" class="xyp" @click="qh(title.xq.downInfo.id,title.xq.downInfo.title)">下一篇:{{title.xq.downInfo.title==undefined?'没有了~~':title.xq.downInfo.title}}</a>
              </div>
            </div>
          </div>
        </div>
        <div class="rt">
          <a href="javascript:;" class="zxgg1 zxgg"></a>
          <a href="javascript:;" class="zxgg2 zxgg"></a>
          <a href="javascript:;" class="zxgg3 zxgg"></a>
        </div>
      </section>
    </div>
  </div>
</template>

<script>
  import axios from 'axios';
  export default {
    name: 'HelloWorld',
    data () {
      return {
        nihao:'你好呀',
        selenv:false,

        msg3:'你好',
        pageName: 'loading',
        msg2:'',
        title:null,
        fuwu:1
      }
    },
    async asyncData ({ params }) {
    let nh = await axios.get(`https://exam.zhonghaiqihang.com/PInterface/Header/headerData`);
    let nh2 = await axios.get(`https://exam.zhonghaiqihang.com/PInterface/Index/indexData`);
    let nh3 = await axios.get(`https://exam.zhonghaiqihang.com/PInterface/Info/infoDetailsData`,{
      params:{
        infoid:params.id
      }});
    let data  = {nav:nh.data,index:nh2.data,id:params.id,xq:nh3.data};
    return { title: data}
  }
  ,head () {
    this.$router.push('/Details/'+this.title.xq.currentInfo.id);
     return {
      title: this.title.xq.currentInfo.title+'-企业邦',
      meta: [
        { hid: 'description', name: 'description', content: this.title.xq.currentInfo.summary },
        { hid: 'keywords', name: 'keywords', content:this.title.xq.currentInfo.keyword }
      ]
    }
  },
  computed: {
    loadList() {
      return (type) => {
        let newData = [];
        this.title.nav.threeServiceData.forEach(item => {
          if(item.pid == type) {
          newData.push(item);
        }
      });
        return newData;
      };
    }
  },
  mounted: function () {
    var nh = this.title.xq.currentInfo.content;
    var nh1 = '' +nh;
    var nh2= this.unescape(nh1);
    console.log(this.title.xq.currentInfo.id);
    console.log(this.title.xq)
    this.msg2 = nh2;
    console.log(this.msg2);
    console.log(this.title.xq.currentInfo.id);
  },
  methods:{
    unescape:function (html) {
      return html
        .replace(html ? /&(?!#?\w+;)/g : /&/g, '&amp;')
        .replace(/&lt;/g, "<")
        .replace(/&gt;/g, ">")
        .replace(/&quot;/g, "\"")
        .replace(/&#39;/g, "\'")
        .replace(/\/UEditOR/g, 'https://exam.zhonghaiqihang.com/UEditOR')

    },qh:function(e,e2) {
      var _this = this;
      if (e2 != undefined) {
        console.log(e)
        const new1 = this.$router.push('/Details/'+e);
        // window.open(new1.href, '_blank');
      }

    },tzlj:function(e){
      const new3 = this.$router.resolve({name: e});
      window.open(new3.href,'_self');
    },
    tzlj1:function(e){
      // const new3 = this.$router.resolve({name: this.dhlj[e]});
      // window.open(new3.href,'_self');
      this.$router.push(e);
    }

  }
  }
</script>

<style>

</style>
